package com.heima.web;

import com.heima.pojo.User;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 其他项目组完成的需求
 */
@RestController
@RequestMapping("/api/v1/user")
public class TestController {

    /**
     * 第三方数据接口
     * @param key
     * @return
     */
    @PostMapping("/findUser")
    public List<User> findUser(@RequestParam(required = false,value = "key") String key){
        List<User> userList = new ArrayList<>();
        if(key.equals("all")){
            userList.add(new User(1,"张三",18,"湖北"));
            userList.add(new User(2,"张四",28,"杭州"));
            userList.add(new User(3,"张五",38,"湖北"));
        }
        return userList;
    }
}
